import request from '@/utils/request.js'


/* 获取当前登录用户的巡检任务  */
export function inspaServiceNet(data) {
	return request({
		url: `/inspect/serverNetwork/userPage`,
		method: 'get',
		params: data
	});
}
export function inspaBase(data) {
	return request({
		url: `/inspect/base/userPage`,
		method: 'get',
		params: data
	});
}

/* getServiceNetDetail */
export function inspaServiceNetDetail(data) {
	return request({
		url: `/inspect/serverNetwork/${data}`,
		method: 'get' 
	});
}

/* getBaseDetail */
export function inspaBaseDetail(data) {
	return request({
		url: `/inspect/base/${data}`,
		method: 'get' 
	});
}




/**获取form表单中的信息
 * @param {string} type: 0:基础环境巡检、 1:UPS巡检表、2:精密空调巡检表、3:新风系统巡检表、4:环境空调巡检表、5:消防及气体灭火巡检表
 * @param {string} id: 内表的id
*/
export function getFormInfoAPI(id, type=0) {
	let url = `/inspect/baseEnvironment/${id}`
	if(type == 1) {
		url = `/inspect/ups/${id}`
	} else if (type == 2) {
		url = `/inspect/airConditioner/${id}`
	} else if (type == 3) {
		url = `/inspect/newTrend/${id}`
	} else if (type == 4) {
		url = `/inspect/environmentControl/${id}`
	} else if (type == 5) {
		url = `/inspect/alarmFire/${id}`
	}
	return request({
		url: url,
		method: 'get'
	});
}


/**修改表单数据
 * 参数见获取
*/
export function updataFormInfoAPI(data, type) {
	let url = `/inspect/baseEnvironment`
	if(type == 1) {
		url = `/inspect/ups`
	} else if (type == 2) {
		url = `/inspect/airConditioner`
	} else if (type == 3) {
		url = `/inspect/newTrend`
	} else if (type == 4) {
		url = `/inspect/environmentControl`
	} else if (type == 5) {
		url = `/inspect/alarmFire`
	}
	
	return request({
		url: url,
		method: 'put',
		data: data
	});
}


/* 获取服务器和网络的详细列表（事件id） */
export function getServerAndEvtInfoListAPI(id) {
	
	return request({
		url: `/inspect/serverNetwork/${id}`,
		method: 'get' 
	});
}


/* 获取服务器和网络的详细信息(通过表单id) */
export function getServerAndEvtInfoAPI(id, type = 1) {
	let url = `/inspect/network/${id}`
	if(type == 2) {
		url = `/inspect/serverStorage/${id}`
	}
	return request({
		url: url,
		method: 'get' 
	});
}

/** 修改服务器和网路的详细信息（表单id） */
export function updataServerAndEvtInfoAPI(data, type = 1) {
	let url = `/inspect/network`
	if(type == 2) {
		url = `/inspect/serverStorage`
	}
	return request({
		url: url,
		method: 'put',
		data:data
	});
}

/* 服务器和网络的巡检分析提交 */
export function updataServerAndEvtxjfxAPI(data, type = 1) {
	let url = `/inspect/network/submit`
	if(type == 2) {
		url = `/inspect/serverStorage/submit`
	}
	return request({
		url: url,
		method: 'put',
		data:data
	});
}





